package cn.oms.file.provider.controller;

import cn.oms.file.api.dto.req.ExcelWriteReq;
import cn.oms.file.api.service.IExcelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

// 描述一个API类
@Api(tags = "Excel服务API接口")
@RestController
@RequestMapping("/file/excel")
@Slf4j
@CrossOrigin
public class ExcelController {

    @Resource
    private IExcelService excelService;

    @Value("${oms.file.excel.upload.path}")
    private String excelUploadPath;

    /**
     * 上传Excel表
     */
    @ApiOperation(value="上传Excel", notes="上传Excel", produces="application/json")
    // 上传Excel API的一组请求参数的描述
    @ApiImplicitParams({
            //  上传Excel API的一个请求参数的描述
            @ApiImplicitParam(name = "excelFileName",value = "Excel文件名称",required = true,dataType = "String"),
            @ApiImplicitParam(name = "excelFilePath",value = "Excel文件存储路径",required = true,dataType = "String"),
            @ApiImplicitParam(name = "to",value = "收件人",required = true,dataType = "String")
    })
    @RequestMapping(value = "/uploadExcel",method = RequestMethod.POST)
    public String uploadExcel(ExcelWriteReq excelWriteReq){

        log.info("前端请求进入-----------------------------");
        log.info("数据为：{}",excelWriteReq);
        return "OK";
    }


}
